
#include "bram.h"
#include "exception.h"


BlockRam::BlockRam(int size)
{
	m_size = size;

	m_memory = new int[m_size];
}


void BlockRam::writeWordA(int address, u32 data)
{
	if(address >= m_size) throw Exception("writeWordA: inaccessible address");
	m_memory[address] = data;
}

u32 BlockRam::readWordA(int address) const
{
	if(address >= m_size) throw Exception("readWordA: inaccessible address");	
	return m_memory[address];
}

void BlockRam::writeWordB(int address, u32 data)
{
	if(address >= m_size) throw Exception("writeWordB: inaccessible address");
	m_memory[address] = data;
}

u32 BlockRam::readWordB(int address) const
{
	if(address >= m_size) throw Exception("readWordB: inaccessible address");	
	return m_memory[address];
}

